﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;

namespace ExcelUnity.Exporter.Exporters
{
    /// <summary>
    /// 导出工作簿
    /// </summary>
    public class ExportSheet
    {
        public ExportSheet(IEnumerable<object> data)
        {
            Data = data.ToList();
            DataType = data.GetType().GetGenericArguments()[0];
        }

        public ExportSheet(DataTable data)
        {
            Table = data;
            DataType = typeof(DataTable);
        }

        /// <summary>
        /// 数据源:列表
        /// </summary>
        public List<object>? Data { get; }

        /// <summary>
        /// 数据源：datatable
        /// </summary>
        public DataTable? Table { get; }

        /// <summary>
        ///shee配置
        /// </summary>
        public ExportSheetConfig? SheetConfig { get; set; }

        /// <summary>
        /// 导出数据的title
        /// </summary>
        public ExportSheetTitle? Title { get; set; }

        /// <summary>
        /// 导出的数据类型
        /// </summary>
        public Type DataType { get; }
    }
}
